class Person:

    def __init__(self,name,sex):
        self.name=name
        self.sex=sex

    #构造方法，自动调用
    def print(self):
        print('姓名:',self.name)
        print('性别:',self.sex)
class Teacher(Person):
    def __init__(self,name,sex,course):
        Person.__init__(self,name,sex)
        self.course=course

    def print(self):
        print('姓名:', self.name)
        print('性别:', self.sex)
        print('课程:',self.course)
class Student(Person):
    def __init__(self,name,sex,grade):
        Person.__init__(self,name,sex)
        self.grade=grade

    def print(self):
        print('姓名:', self.name)
        print('性别:', self.sex)
        print('成绩:',self.grade)
def main():
    person=Person('张三','男')
    teacher=Teacher('李四','男','数学')
    student=Student('小林','男',90)
    person.print()
    teacher.print()
    student.print()



if __name__=='__main__':
    main()
